package digitalmat.p.com.google.code;

import java.awt.GridLayout;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.ListModel;


public class EditPanel extends JSplitPane {


   public EditPanel() {
      this.setup();
      }

   protected JComponent top() {
      JPanel panel = new JPanel();

      panel.setLayout(new GridLayout(3, 3, 5, 5));
      panel.add(new JButton("1"));
      panel.add(new JButton("2"));
      panel.add(new JButton("3"));
      panel.add(new JButton("4"));
      panel.add(new JButton("5"));
      panel.add(new JButton("6"));
      panel.add(new JButton("7"));
      panel.add(new JButton("8"));
      panel.add(new JButton("8"));

      return panel;
      }

   protected JComponent bottom() {
      JTabbedPane tab_pane = new JTabbedPane();

      ListModel list_model;
      DefaultListModel model = new DefaultListModel();
      model.setSize(4);
      model.setElementAt("Element1", 0);
      model.setElementAt("Element2", 1);
      model.setElementAt("Element3", 2);
      model.setElementAt("Element4", 3);

      JList list1 = new JList(model);

      tab_pane.addTab("tab1", list1);
      tab_pane.addTab("tab2", new JButton("tab2"));
      tab_pane.addTab("tab3", new JButton("tab3"));

      return tab_pane;
      }


   protected void setup() {
      this.setOrientation(JSplitPane.VERTICAL_SPLIT);
      this.setOneTouchExpandable(true);

      this.setLeftComponent(this.top());
      this.setRightComponent(this.bottom());
      }

   }
